package com.jzo2o.customer.controller.operation;

import com.jzo2o.common.model.PageResult;
import com.jzo2o.customer.model.dto.request.WorkerCertificationAuditPageQueryReqDTO;
import com.jzo2o.customer.model.dto.response.WorkerCertificationAuditResDTO;
import com.jzo2o.customer.service.IWorkerCertificationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author itcast
 */
@RestController("OperationWorkerCertificationAuditController")
@RequestMapping("/operation/worker-certification-audit")
@Api(tags = "运营端 - 服务人员认证信息审核相关接口")
public class WorkerCertificationAuditController {
    //GET  /customer/operation/worker-certification-audit/page
    @Autowired
    private IWorkerCertificationService workerCertificationService;
    @GetMapping("/page")
    @ApiOperation("审核服务人员认证分页查询")
    public PageResult<WorkerCertificationAuditResDTO> page(WorkerCertificationAuditPageQueryReqDTO dto) {
        return workerCertificationService.getPage(dto);
    }
    /**
     * 审核服务人员认证信息
     * 接口路径：PUT /customer/operation/worker-certification-audit/audit/{id}
     */
    @PutMapping("/audit/{id}")
    @ApiOperation("审核服务人员认证信息")
    public void audit(@PathVariable("id") Long id,
                      @RequestParam("certificationStatus") Integer certificationStatus,
                      @RequestParam(name = "rejectReason", required = false) String rejectReason
    ) {
        workerCertificationService.review(id, certificationStatus, rejectReason);
    }
}
